<!DOCTYPE html>
<html lang="en">
<head>
    <meta name="viewport" content="width=device-width,user-scalable=0"/>
    <meta charset="UTF-8">
    <title>BD健身</title>
    <script src="__api__/js/fontSize.js"></script>
    <link rel="stylesheet" href="__api__/css/bootstrap.min.css">
    <link rel="stylesheet" href="__api__/css/reset.css">
    <link rel="stylesheet" href="__api__/css/my_main.css">
</head>
<body>
<div class="register">

        <div class="regTitle">
            <h2>忘记密码</h2>
        </div>
        <div class="reg_form">

            <form action="#" class="form-horizontal" onsubmit="return false">
                <div class="form-group">
                    <div class="icon">
                        <img src="__api__/images/user_icon.png">
                    </div>
                    <input type="tel" name="telphone"  id='sj' class="form-control" placeholder="请输入手机号">
                </div>

                <div class="form-group">
                    <div class="icon">
                        <img src="__api__/images/code_icon.png">
                    </div>
                    <input type="text" name="code" id="sj2" class="form-control" placeholder="验证码">
                    <button class="btnCode" id="getsms">获取验证码</button>
                </div>
                 <div class="container">
                <button class="btn btn-primary"  type="submit" id="nex">下一步</button>
                </div>

            </form>
        </div>



</div>
<script src="__assets__/js/jquery.min.js"></script>
<script src="__assets__/layui.js"></script>
<script type="text/javascript">

$(function(){
	var layer;
	layui.use('layer', function(){
		   layer = layui.layer;
		  
		 
		});

	$('#nex').click(function(){
		var telphone=$('#sj').val();
		var code=$('#sj2').val();
		var url="__up__/api/user/process_password";
		//console.log(url);
		var data={telphone:telphone,code:code};
		$.post(url,data,function(res){
			var obj=eval('(' +res+')');
			//console.log(obj);
			var status=obj.status;
			var info=obj.info;
			var info=decodeURI(info);
			
			if(status==-1){
				layer.msg(info,{icon:5});
			}else if(status==404){
				layer.msg(info,{icon:5});
			}else if(status==400){
				layer.msg(info,{icon:5});
			}else{
				layer.msg(info,{icon:6},function(){
					window.location.href=obj.data+"?telphone="+telphone;
				});
			}
			
		})
	});
	
	$('#getsms').click(function(){
		var url="__up__/api/user/getTextValidateCode";
		var telphone=$('#sj').val();
		var data={telphone:telphone};
		$.get(url,data,function(res){
			var obj=eval('(' +res+')');
			var status=obj.status;
			var info=obj.info;
			if(status==-1){
				layer.msg(info,{icon:5});
			}else if(status==414){
				layer.msg(info,{icon:5});
			}else if(status==400){
				layer.msg(info,{icon:5});
			}else{
				layer.msg(info,{icon:6});
			}
		})
	})
	
})








</script>


</body>
</html>